<?php $this->load->view('head');?>
<!--content start-->
<div id="bagu-content">
    <form action="" method="post" id="member_add">
    	<table width="100%" cellpadding="0" cellspacing="0" class="table_add" align="center" style="font-size:14px;">
        	<tr>
            	<td>淘宝账号/QQ号码:</td>
          <td><input type="text" value="" name="account" id="account" /><span id="account_result"></span></td>
                <td>客户类型:</td>
                <td>
                	<select name="member_type" style="font-family:'微软雅黑',Verdana, Arial, Helvetica, sans-serif; font-size:14px;">
                    	<option selected="selected" value="普通客户">普通客户</option>
                        <option value="代理客户">代理客户</option>
                    </select>
                </td>
            </tr>
            <tr>
            	<td>客户姓名:</td>
          <td><input type="text" value="" name="name" id="name" /></td>
                <td>联系电话:</td>
                <td><input type="text" value="" name="mobile" id="mobile" /></td>
            </tr>
            <tr>
                <td>QQ号码:</td>
          <td><input type="text" value="" name="qq" id="qq" /></td>
                <td>常用邮箱:</td>
                <td><input type="text" value="" name="email" id="email" /></td>
            </tr>
            <tr>
            	<td>性别:</td>
                <td>
           	    <label for="woman"><input type="radio" value="0" name="sex" checked="checked" id="woman" />女</label>
                    <label for="man"><input type="radio" value="1" name="sex" id="man" />男</label>
                </td>
                <td>过生日习俗:</td>
                <td>
                	<label for="lunar"><input type="radio" value="0" name="habitude" checked="checked" id="lunar" />阴历</label>
                    <label for="solar"><input type="radio" value="1" name="habitude" id="solar" />阳历</label>
                </td>
            </tr>
            <tr>
                <td>阴历生日:</td>
                <td><input type="text" value="" name="lyear" id="lyear" style="width:50px;" />年<input type="text" value="" name="lbirthday" id="lbirthday" style="width:70px;" />月-日</td>
                <td>阳历生日:</td>
                <td><input type="text" value="" name="syear" id="syear" style="width:50px;" />年<input type="text" value="" name="sbirthday" id="sbirthday" style="width:70px;"/>月-日</td>
            </tr>
            <tr>
                <td>联系地址:</td>
                <td colspan="3"><input type="text" value="" name="address" id="address" style="width:480px;" /></td>
            </tr>
            <tr>
                <td colspan="4">其他信息:</td>
            </tr>
            <tr>
                <td colspan="4"><textarea name="others" id="others" cols="110" rows="2"></textarea></td>
            </tr>
            <tr>
                <td colspan="4"><input type="submit" name="submit" value="添加会员" /></td>
            </tr>

        </table>
    </form>
</div>
<!--content end-->	
<?php $this->load->view('footer');?>
<script type="text/javascript">
	var account_status = false;
	$('#account').focusout(function(){
		var account = $(this).val();
		$.post('<?=site_url('member/check_account')?>',{account:account},function(data){
			if(data=='exist')
			{
				$("#account_result").html('<span style="color:red">已经存在</span>');
				account_status = false;
			}
			else
			{
				$("#account_result").html('');
				account_status = true;
			}
		});
	});
	$('#member_add').submit(function(){
		if(account_status==false)
		{
			alert('请检查账号!');
			$("#account").focus();
			return false;
		}
		var lbirthday = $("#lbirthday").val();
		if(lbirthday.match(/^[0-9]{2}-[0-9]{2}$/)==null)
		{
			alert('阴历生日格式不正确!');
			$("#lbirthday").focus();
			return false;	
		}
		var sbirthday = $('#sbirthday').val();
		if(sbirthday.match(/^[0-9]{2}\-[0-9]{2}$/)==null)
		{
			alert('阳历生日格式不正确!');
			$("#sbirthday").focus();
			return false;	
		}
	});
</script>